home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume8 / kurses < prev    next >
Encoding:
Internet Message Format  |  1987-02-08  |  19.0 KB

  1. Subject:  v08i052:  A program to call curses(3) functions
  2. Newsgroups: mod.sources
  3. Approved: mirror!rs
  4.  
  5. Submitted by: sdcrdcf!trwrb!ries (Marc Ries)
  6. Mod.sources: Volume 8, Issue 52
  7. Archive-name: kurses
  8.  
  9. [  Interested parties may also want to see tput, in Volume 7.  --r$  ]
  10.  
  11. # Cut_Here-----Cut_Here-----Cut_Here---------Cut_Here
  12. #! /bin/sh
  13. # This is a shell archive, meaning:
  14. # 1. Remove everything above the #! /bin/sh line.
  15. # 2. Save the resulting text in a file.
  16. # 3. Execute the file with /bin/sh (not csh) to create:
  17. #    README
  18. #    att_kurses.mk
  19. #    bsd_kurses.mk
  20. #    kshtest
  21. #    kurses.1
  22. #    kurses.c
  23. #    shtest
  24. export PATH; PATH=/bin:/usr/bin:$PATH
  25. echo shar: "extracting 'README'" '(1007 characters)'
  26. if test -f 'README'
  27. then
  28.     echo shar: "will not over-write existing file 'README'"
  29. else
  30. cat << \RiesES_PIECES > 'README'
  31. Kurses (aka, curse) was published to the net several years ago.
  32.  
  33. With some changes, it has proved to be a powerful interpreter for
  34. manipulating  VDT  screens,  and  (especially  combined  with ksh
  35. functions)  can  be  a  "production"  quality  UNIX   application
  36. development tool.
  37.  
  38. The need arose  to  be  able  to  drive  "kurses"  scripts  under
  39. terminfo, and kurses has been (quickly) ported to SYSVR3.
  40.  
  41. Compile  it  for  pre-terminfo  UNIX's  via  the  'bsd_kurses.mk"
  42. makefile or for terminfo UNIX via 'att_kurses.mk'.
  43.  
  44. A man page is included (and note the origional  author,  Jonathan
  45. Bowen of Oxford, England).
  46.  
  47. Your can "test" kurses on your VDT using 'shtest' for the  Bourne
  48. shell  or 'kshtest' for the Korn shell.  Not *all* of the options
  49. have been thoroughly tested but the most useful  ones  should  be
  50. OK.
  51.  
  52. Please send bugs [features 8-{)] and fixes  and  improvements  to
  53. me:
  54.  
  55.         Marc A. Ries
  56.  
  57.         sdcrdcf!---\
  58.                 ihnp4!------\----- trwrb! --- ries
  59.                 ucbvax!-----/  
  60. RiesES_PIECES
  61. fi
  62. echo shar: "extracting 'att_kurses.mk'" '(547 characters)'
  63. if test -f 'att_kurses.mk'
  64. then
  65.     echo shar: "will not over-write existing file 'att_kurses.mk'"
  66. else
  67. cat << \RiesES_PIECES > 'att_kurses.mk'
  68. #
  69. # Makefile: kurses
  70. #  Created: Thursday, November 06, 1986
  71. #       By: Marc Ries (TRW Operations and Support Group)
  72. #
  73. CC     = /bin/cc
  74. OPTS   = -O -s 
  75. # DEFS   = -DBSD
  76. DEFS   = -DSYSV
  77. CFLAGS = $(OPTS) $(DEFS)
  78. SRCS   = kurses.c
  79. OBJS   = kurses.o
  80. # Define LIB2 if target system is Berkeley Version
  81. # LIB2    = -ltermcap
  82. LIBS    = -lcurses $(LIB2)
  83.  
  84. all:    kurses
  85.  
  86. kurses:    $(OBJS)
  87.     $(CC) $(CFLAGS) -o kurses $(OBJS) $(LIBS)
  88.  
  89. clean:
  90.     rm -f $(OBJS) a.out core
  91.  
  92. shar:
  93.     shar -v kurses.[1clyh] Makefile > kurses.shr
  94.  
  95. edit:
  96.     vi $(SRCS)
  97.  
  98. kurses.o:    kurses.c
  99. RiesES_PIECES
  100. fi
  101. echo shar: "extracting 'bsd_kurses.mk'" '(545 characters)'
  102. if test -f 'bsd_kurses.mk'
  103. then
  104.     echo shar: "will not over-write existing file 'bsd_kurses.mk'"
  105. else
  106. cat << \RiesES_PIECES > 'bsd_kurses.mk'
  107. #
  108. # Makefile: kurses
  109. #  Created: Thursday, November 06, 1986
  110. #       By: Marc Ries (TRW Operations and Support Group)
  111. #
  112. CC     = /bin/cc
  113. OPTS   = -O -s 
  114. DEFS   = -DBSD
  115. # DEFS   = -DSYSV
  116. CFLAGS = $(OPTS) $(DEFS)
  117. SRCS   = kurses.c
  118. OBJS   = kurses.o
  119. # Define LIB2 if target system is Berkeley Version
  120. LIB2    = -ltermcap
  121. LIBS    = -lcurses $(LIB2)
  122.  
  123. all:    kurses
  124.  
  125. kurses:    $(OBJS)
  126.     $(CC) $(CFLAGS) -o kurses $(OBJS) $(LIBS)
  127.  
  128. clean:
  129.     rm -f $(OBJS) a.out core
  130.  
  131. shar:
  132.     shar -v kurses.[1clyh] Makefile > kurses.shr
  133.  
  134. edit:
  135.     vi $(SRCS)
  136.  
  137. kurses.o:    kurses.c
  138. RiesES_PIECES
  139. fi
  140. echo shar: "extracting 'kshtest'" '(1779 characters)'
  141. if test -f 'kshtest'
  142. then
  143.     echo shar: "will not over-write existing file 'kshtest'"
  144. else
  145. cat << \RiesES_PIECES > 'kshtest'
  146. #!/bin/ksh
  147. trap 'kurses -cl;exit' 1 2 3 15
  148. function main_menu
  149. {
  150.  kurses \
  151.  -cm 0 1 \
  152.  -ce \
  153.  '*********************************** M E N U ************************************' \
  154.  -cm 0 2 -ce \
  155.  -cm 0 3 \
  156.  -ce \
  157.  '         1   Display Modules A thru P' \
  158.  -cm 0 4 \
  159.  -ce \
  160.  '         2   Display Modules Q thru Z' \
  161.  -cm 0 5 \
  162.  -ce \
  163.  '         3   Display Sub-Modules A thru Z' \
  164.  -cm 0 6 \
  165.  -ce \
  166.  '         4   Display HELP information' \
  167.  -cm 0 7 \
  168.  -ce \
  169.  '         5   Exit.' \
  170.  -cm 0 8 \
  171.  -ce \
  172.  -cm 0 9 \
  173.  -ce \
  174.  '             Enter Option: ' \
  175.  -cm 0 10 \
  176.  -ce \
  177.  -cm 0 22 \
  178.  '****************************  Default is Option 1  *****************************' \
  179.  -cm 27 9
  180.  ;
  181. }
  182. #
  183. function help_menu
  184. {
  185. kurses -cm 0 11
  186. cat  <<+ENDCAT
  187. ******************************  HELP INFORMATION  ******************************
  188. Option 1 - Help information for Option 1
  189.            
  190.            
  191.            
  192. Option 2 - Help information for Option 2
  193.            
  194.            
  195. Option 3 - Help information for Option 3
  196.            
  197. Option 5 - Exit this program.
  198. +ENDCAT
  199. }
  200. #
  201. function clrlwin
  202. {
  203.     kurses \
  204.     -cm 0 11 \
  205.     '*****************************************' \
  206.     '***************************************' \
  207.     -cm 0 12 -ce \
  208.     -cm 0 13 -ce \
  209.     -cm 0 14 -ce \
  210.     -cm 0 15 -ce \
  211.     -cm 0 16 -ce \
  212.     -cm 0 17 -ce \
  213.     -cm 0 18 -ce \
  214.     -cm 0 19 -ce \
  215.     -cm 0 20 -ce \
  216.     -cm 0 21 -ce \
  217.     -cm 0 22  \
  218.     '*************************************************************'
  219.         ;
  220. }
  221. kurses -cl
  222. status=loop
  223. while test $status = "loop"
  224. do
  225.  main_menu
  226.  read response
  227.  case "$response" in
  228.     4)  help_menu
  229.         status=loop
  230.         ;;
  231.     5)  kurses -cl
  232.         status=exit
  233.         exit
  234.         ;;
  235.     *)  clrlwin 
  236.         kurses \
  237.         -cm 13 9 -ce \
  238.         'Enter Option: '
  239.         status=loop
  240.         ;;
  241.  esac
  242. done
  243. RiesES_PIECES
  244. chmod +x 'kshtest'
  245. fi
  246. echo shar: "extracting 'kurses.1'" '(2606 characters)'
  247. if test -f 'kurses.1'
  248. then
  249.     echo shar: "will not over-write existing file 'kurses.1'"
  250. else
  251. cat << \RiesES_PIECES > 'kurses.1'
  252. .TH CURSE 1 "14 November 1986"
  253. .UC 4
  254. .SH NAME
  255. kurses \- screen functions
  256. .SH SYNOPSIS
  257. .B kurses
  258. [ options ] [ text ] ...
  259. .SH DESCRIPTION
  260. This command gives the user a method of updating the screen from a shell.
  261. The options are two letter variable names from (the Berkeley version of)
  262. .I curses.h
  263. as detailed in Appendix A of
  264. .I "Screen Updating and Cursor Movement Optimization: A Library Package".
  265. All the
  266. .I char*
  267. type variables are included.  In addition, two numeric options 
  268. (-li and -co) are recognized, so you can adapt your work to any 
  269. screen shape size.
  270. Some commonly used options are:
  271. .TP 6
  272. .B -cd
  273. Clear to end of Display.
  274. .TP 6
  275. .B -ce
  276. Clear to End of line.
  277. .TP 6
  278. .B -cl
  279. CLear screen.
  280. This is exactly like the
  281. .I clear
  282. command.
  283. .TP 6
  284. .B -cm
  285. Cursor Motion.
  286. This takes the next two numerical arguments on the command line to be the
  287. .I x
  288. and
  289. .I y
  290. coordinates of the desired position of the cursor from the
  291. .I home
  292. position
  293. .I (0,0)
  294. at the top lefthand corner of the screen.
  295. .TP 6
  296. .B -ho
  297. HOme cursor.
  298. This moves the cursor to the top lefthand corner of the screen.
  299. This is equivalent to
  300. .I -cm 0 0.
  301. .TP 6
  302. .B -ll
  303. Last Line.
  304. This moves the cursor to the bottom lefthand corner of the screen.
  305. This is equivalent to
  306. .I -cm 0 23
  307. on a standard 24 line screen.
  308. .TP 6
  309. .B -se
  310. Standout End (may leave space).
  311. .TP 6
  312. .B -so
  313. Stand Out begin (may leave space).
  314. This normally produces reverse video but depends on the terminal\'s
  315. capabilities.
  316. .TP 6
  317. .B -ue
  318. Underline Ending sequence.
  319. .TP 6
  320. .B -us
  321. Underline Starting sequence.
  322. .TP 6
  323. .B -xx
  324. Prints all allowable options.
  325. .PP
  326. The options may be given in upper or lower case.
  327. Letters after the first two characters are ignored
  328. (e.g.
  329. .B -clear
  330. may be used instead of
  331. .B -cl
  332. ).
  333. Any arguments not starting with a `-' are treated as text and are
  334. printed at the current cursor position in the current style
  335. (e.g. standout mode).
  336. For example, to print a message in standout mode at the center of a
  337. standard 80 by 24 character screen and leave the cursor at the bottom
  338. of the screen, the following sequence could be used:
  339. .PP
  340. .ti+8n
  341. kurses -cl -cm 34 11 -so \'Long Live UNIX\' -se -ll
  342. .SH SEE ALSO
  343. .I "Screen Updating and Cursor Movement Optimization: A Library Package,"
  344. Ken Arnold,
  345. .br
  346. clear(1) or tput(1),
  347. curses(3x),
  348. termcap(5) or terminfo(5)
  349. .SH AUTHORS
  350. Jonathan Bowen, PRG, Oxford, England
  351. .br
  352. Marc Ries, TRW, California
  353. .SH BUGS
  354. Some options will only work if the corresponding 
  355. .I termcap
  356. (if compiled for curses) or
  357. .I terminfo
  358. (if compiled for terminfo)
  359. entry has been set for the terminal in use (e.g. standout mode).
  360. Cursor motion may not work on some terminals.
  361. RiesES_PIECES
  362. fi
  363. echo shar: "extracting 'kurses.c'" '(9141 characters)'
  364. if test -f 'kurses.c'
  365. then
  366.     echo shar: "will not over-write existing file 'kurses.c'"
  367. else
  368. cat << \RiesES_PIECES > 'kurses.c'
  369.  
  370.  
  371. /*
  372.  * File name:        x %I%
  373.  * By:                  Marc Ries
  374.  * Latest change:    Thursday, November 13, 1986
  375.  * Purpose of this file:
  376.  *     Screen manipulations via a shell 
  377.  * 
  378.  */
  379. #include <curses.h>
  380. #ifndef BSD
  381. #include <term.h>
  382. #endif BSD
  383.  
  384. void exit();
  385. char *tparm();
  386.  
  387. outc (c)
  388. int  c;
  389. {
  390.     (void) putchar(c);
  391. }
  392.  
  393. main(argc, argv)
  394. int argc;
  395. char *argv[];
  396. {
  397.     char c1, c2, *s;
  398.     char *i_xy;
  399.     int x, y, errret;
  400.  
  401.     if (--argc <= 0) {
  402.         (void) fprintf(stderr,"Usage: kurses -xx ...\n");
  403.         exit(1);
  404.     }
  405. #ifndef BSD
  406.     if ((setupterm(0,1,&errret)) == -1) {
  407.         (void) fprintf(stderr, "Unknown terminfo terminal type!\n");
  408.         exit(1);
  409.     }
  410. #else
  411.     initscr();
  412. #endif BSD
  413.     while (--argc >= 0) {
  414.         ++argv;
  415.         if ((*argv)[0] == '-') {
  416.         c1 = (*argv)[1];
  417.         if ((c1 >= 'A') && (c1 <= 'Z')) c1 = c1+'a'-'A';
  418.         c2 = (*argv)[2];
  419.         if ((c2 >= 'A') && (c2 <= 'Z')) c2 = c2+'a'-'A';
  420.  
  421.         if ((c1 == 'x') && (c2 == 'x')) {
  422.             (void) printf("Legal options are:\n");
  423.             (void) printf("al,bc,bt,cd,ce,cl,cm,dc,dl,dm,do,ed,ei,ho\n");
  424.             (void) printf("ic,im,ip,ll,ma,nd,pc,se,sf,so,sr,ta,te,ti\n");
  425.             (void) printf("uc,ue,ul,us,vb,ve,vs\n");
  426.             (void) printf("Numeric valued capabilities:\n");
  427.             (void) printf("li and co\n");
  428.         }
  429.         else if ((c1 == 'a') && (c2 == 'l')) {
  430. #ifndef BSD
  431.                         tputs(key_il, 1, outc);
  432. #else
  433.                         tputs(AL, 1, outc);
  434. #endif BSD
  435.                 }
  436. #ifndef BSD
  437.         else if ((c1 == 'b') && (c2 == 'c')) {
  438.             (void) printf("%s",cursor_left); 
  439.         }
  440.         else if ((c1 == 'b') && (c2 == 't')) {
  441.                         tputs(back_tab, 1, outc);
  442.         }
  443. #else
  444.         else if ((c1 == 'b') && (c2 == 'c')) (void) printf("%s",BC);
  445.         else if ((c1 == 'b') && (c2 == 't')) (void) printf("%s",BT);
  446. #endif BSD
  447.         else if ((c1 == 'c') && (c2 == 'd')) {
  448. #ifndef BSD
  449.                         tputs(clr_eos, 1, outc);
  450. #else
  451.                         tputs(CD, 1, outc);
  452. #endif BSD
  453.                 }
  454.         else if ((c1 == 'c') && (c2 == 'e')) {
  455. #ifndef BSD
  456.                         putp(clr_eol);
  457. #else
  458.                         tputs(CE, 1, outc);
  459. #endif BSD
  460.                 }
  461.         else if ((c1 == 'c') && (c2 == 'l')) {
  462. #ifndef BSD
  463.                         putp(clear_screen);
  464. #else
  465.                         tputs(CL, 1, outc);
  466. #endif BSD
  467.                 }
  468.         else if ((c1 == 'c') && (c2 == 'm')) {
  469.             if ((argc -= 2) < 0) {
  470.                 (void) fprintf(stderr,"Usage: kurses -cm X Y\n");
  471.                 exit(1);
  472.             }
  473.             x = (char)atoi(*++argv);
  474.             y = (char)atoi(*++argv);
  475. #ifndef BSD
  476.              i_xy = (tparm(cursor_address,y,x));
  477.              tputs(i_xy,0,outc);
  478. #else
  479.             movecursor(x,y);
  480. #endif BSD
  481.         }
  482. #ifndef BSD
  483.         else if ((c1 == 'c') && (c2 == 'o')) (void) printf("%d", columns);
  484. #else
  485.         else if ((c1 == 'c') && (c2 == 'o')) (void) printf("%d", COLS);
  486. #endif BSD
  487.         else if ((c1 == 'd') && (c2 == 'c')) {
  488. #ifndef BSD
  489.                         tputs(parm_dch, 1, outc);
  490. #else
  491.                         tputs(DC, 1, outc);
  492. #endif BSD
  493.                 }
  494.         else if ((c1 == 'd') && (c2 == 'l')) {
  495. #ifndef BSD
  496.                         tputs(key_dl, 1, outc);
  497. #else
  498.                         tputs(DL, 1, outc);
  499. #endif BSD
  500.                 }
  501. #ifndef BSD
  502.         else if ((c1 == 'd') && (c2 == 'm')) {
  503.             (void) printf("%s",enter_delete_mode);
  504. #else
  505.         else if ((c1 == 'd') && (c2 == 'm')) (void) printf("%s",DM);
  506.         else if ((c1 == 'd') && (c2 == 'o')) (void) printf("%s",DO);
  507.         else if ((c1 == 'e') && (c2 == 'd')) (void) printf("%s",ED);
  508.         else if ((c1 == 'e') && (c2 == 'i')) (void) printf("%s",EI);
  509.         else if ((c1 == 'h') && (c2 == 'o')) {
  510.             if (*HO != '\0') (void) printf("%s",HO);
  511.             else movecursor(0,0);
  512. #endif BSD
  513.         }
  514. #ifndef BSD
  515.         else if ((c1 == 'd') && (c2 == 'o')) {
  516.             (void) printf("%s",cursor_down); 
  517.         }
  518.         else if ((c1 == 'e') && (c2 == 'd')) {
  519.             (void) printf("%s",exit_delete_mode); 
  520.         }
  521.         else if ((c1 == 'e') && (c2 == 'i')) {
  522.             (void) printf("%s",exit_insert_mode); 
  523.         }
  524.         else if ((c1 == 'h') && (c2 == 'o')) { 
  525.             putp(cursor_home);
  526.         }
  527. #endif BSD
  528.         else if ((c1 == 'i') && (c2 == 'c')) {
  529. #ifndef BSD
  530.                         tputs(insert_character, 1, outc);
  531. #else
  532.                         tputs(IC, 1, outc);
  533. #endif BSD
  534.                 }
  535. #ifndef BSD
  536.         else if ((c1 == 'i') && (c2 == 'm')) {
  537.             (void) printf("%s",enter_insert_mode);
  538.         }
  539. #else
  540.         else if ((c1 == 'i') && (c2 == 'm')) (void) printf("%s",IM);
  541. #endif BSD
  542.         else if ((c1 == 'i') && (c2 == 'p')) {
  543. #ifndef BSD
  544.                         tputs(insert_padding, 1, outc);
  545. #else
  546.                         tputs(IP, 1, outc);
  547. #endif BSD
  548.                 }
  549. #ifndef BSD
  550.         else if ((c1 == 'l') && (c2 == 'l')) { 
  551.             if (*cursor_to_ll != '\0') {
  552.                 putp(cursor_to_ll);
  553.             }
  554.              i_xy = (tparm(cursor_address,lines-1,0));
  555.              tputs(i_xy,0,outc);
  556. #else
  557.         else if ((c1 == 'l') && (c2 == 'l')) {
  558.             if (*LL != '\0') (void) printf("%s",LL);
  559.             else movecursor(0,LINES-1);
  560. #endif BSD
  561.         }
  562. #ifndef BSD
  563.         else if ((c1 == 'l') && (c2 == 'i')) {
  564.             (void) printf("%d", lines);
  565.         }
  566.         else if ((c1 == 'n') && (c2 == 'd')) {
  567.             (void) printf("%s",cursor_right);
  568.         }
  569.         else if ((c1 == 'p') && (c2 == 'c')) {
  570.             (void) printf("%s",pad_char);
  571.         }
  572.         else if ((c1 == 's') && (c2 == 'e')) {
  573.                         tputs(exit_standout_mode, 1, outc);
  574.         }
  575. #else
  576.         else if ((c1 == 'l') && (c2 == 'i')) (void) printf("%d", LINES);
  577.         else if ((c1 == 'm') && (c2 == 'a')) (void) printf("%s",MA);
  578.         else if ((c1 == 'n') && (c2 == 'd')) (void) printf("%s",ND);
  579.         else if ((c1 == 'p') && (c2 == 'c')) (void) printf("%s",PC);
  580.         else if ((c1 == 's') && (c2 == 'e')) (void) printf("%s",SE);
  581. #endif BSD
  582.         else if ((c1 == 's') && (c2 == 'f')) {
  583. #ifndef BSD
  584.                         tputs(scroll_forward, 1, outc);
  585. #else
  586.                         tputs(SF, 1, outc);
  587. #endif BSD
  588.                 }
  589. #ifndef BSD
  590.         else if ((c1 == 's') && (c2 == 'o')) {
  591.                         tputs(enter_standout_mode, 1, outc);
  592.         }
  593.         else if ((c1 == 's') && (c2 == 'r')) { 
  594. #else
  595.         else if ((c1 == 's') && (c2 == 'o')) (void) printf("%s",SO);
  596.         else if ((c1 == 's') && (c2 == 'r')) {
  597. #endif BSD
  598. #ifndef BSD
  599.                         *scroll_reverse = tputs(scroll_reverse, 1, outc);
  600.                         (void) printf("%s",scroll_reverse);
  601. #else
  602.                         *SR = tputs(SR, 1, outc);
  603.                         (void) printf("%s",SR);
  604. #endif BSD
  605.                 }
  606.         else if ((c1 == 't') && (c2 == 'a')) {
  607. #ifndef BSD
  608.                         tputs(tab, 1, outc);
  609. #else
  610.                         tputs(TA, 1, outc);
  611. #endif BSD
  612.                 }
  613. #ifndef BSD
  614.         else if ((c1 == 't') && (c2 == 'e')) {
  615.             (void) printf("%s",exit_ca_mode); 
  616.         }
  617.         else if ((c1 == 't') && (c2 == 'i')) {
  618.             (void) printf("%s",enter_ca_mode); 
  619.         }
  620.         else if ((c1 == 'u') && (c2 == 'c')) {
  621.                         tputs(underline_char, 1, outc);
  622.         }
  623.         else if ((c1 == 'u') && (c2 == 'e')) {
  624.                         tputs(exit_underline_mode, 1, outc);
  625.         }
  626.         else if ((c1 == 'u') && (c2 == 'l')) {
  627.             (void) printf("%s",transparent_underline);
  628.         }
  629.         else if ((c1 == 'u') && (c2 == 's')) {
  630.                         tputs(enter_underline_mode, 1, outc);
  631.         }
  632.         else if ((c1 == 'v') && (c2 == 'b')) {
  633.                         tputs(flash_screen, 1, outc);
  634.         }
  635.         else if ((c1 == 'v') && (c2 == 'e')) {
  636.                         tputs(cursor_normal, 1, outc);
  637.         }
  638.         else if ((c1 == 'v') && (c2 == 's')) {
  639.                         tputs(cursor_visible, 1, outc);
  640.         }
  641. #else
  642.         else if ((c1 == 't') && (c2 == 'e')) (void) printf("%s",TE);
  643.         else if ((c1 == 't') && (c2 == 'i')) (void) printf("%s",TI);
  644.         else if ((c1 == 'u') && (c2 == 'c')) (void) printf("%s",UC);
  645.         else if ((c1 == 'u') && (c2 == 'e')) (void) printf("%s",UE);
  646.         else if ((c1 == 'u') && (c2 == 'l')) (void) printf("%s",UL);
  647.         else if ((c1 == 'u') && (c2 == 's')) (void) printf("%s",US);
  648.         else if ((c1 == 'v') && (c2 == 'b')) (void) printf("%s",VB);
  649.         else if ((c1 == 'v') && (c2 == 'e')) (void) printf("%s",VE);
  650.         else if ((c1 == 'v') && (c2 == 's')) (void) printf("%s",VS);
  651. #endif BSD
  652.         else (void) fprintf(stderr,"kurses: unknown option %s\n",*argv);
  653.         }
  654.         else for (s = argv[0]; *s != '\0'; s++) (void) putchar(*s);
  655.     }
  656. #ifndef BSD
  657.     resetterm();
  658.     exit(0);
  659. #else
  660.     endwin();
  661. #endif BSD
  662. }
  663.  
  664. #ifdef BSD
  665. movecursor(x,y)
  666. int x, y;
  667. {
  668.     char n, *s;
  669.     int i = 0, rev = 0;
  670.  
  671.     for (s = CM; *s != '\0'; s++) {
  672.               while (*s >= '0' && *s <= '9') *s++; /* strip padding nums */
  673.                 
  674.         if (*s != '%') (void) putchar(*s);
  675.         else {
  676.             switch (i) {
  677.                 case 0:    n = (rev?x:y);
  678.                     break;
  679.                 case 1:    n = (rev?y:x);
  680.                     break;
  681.                 default: n = '\0';
  682.             }
  683.             switch(*++s) {
  684.                 case 'd':    (void) printf("%d",n);
  685.                         i++;
  686.                         break;
  687.                 case '2':    (void) printf("%2d",n);
  688.                         i++;
  689.                         break;
  690.                 case '3':    (void) printf("%3d",n);
  691.                         i++;
  692.                         break;
  693.                 case '+':    n += (int)*++s;
  694.                 case '.':    (void) printf("%c",(char)n);
  695.                         i++;
  696.                         break;
  697.                 case '>':    if (n > (int)*++s) n+=(int)*++s;
  698.                         else *++s;
  699.                         break;
  700.                 case 'i':    x++; y++;
  701.                         break;
  702.                 case 'n':    x ^= 0140; y ^= 0140;
  703.                         break;
  704.                 case 'B':    x = (16*(x/10))+(x%10);
  705.                         y = (16*(y/10))+(y%10);
  706.                         break;
  707.                 case 'D':    x = (x-2*(x%16));
  708.                         y = (y-2*(y%16));
  709.                 case 'r':    rev++;
  710.                         break;
  711.                 default:    *--s;
  712.                 case '%':    break;
  713.             }
  714.         }
  715.     }
  716. }
  717. #endif BSD
  718. RiesES_PIECES
  719. fi
  720. echo shar: "extracting 'shtest'" '(1682 characters)'
  721. if test -f 'shtest'
  722. then
  723.     echo shar: "will not over-write existing file 'shtest'"
  724. else
  725. cat << \RiesES_PIECES > 'shtest'
  726. #!/bin/sh
  727. trap 'kurses -cl; exit' 1 2 3 15
  728.  kurses -cl \
  729.  -cm 0 1 \
  730.  -ce \
  731.  '*********************************** MENU ***************************************' \
  732.  -cm 0 2 -ce \
  733.  -cm 0 3 \
  734.  -ce \
  735.  '         1   Display Menu Subject 1.' \
  736.  -cm 0 4 \
  737.  -ce \
  738.  '         2   Display Alternate Menu Items.' \
  739.  -cm 0 5 \
  740.  -ce \
  741.  '         3   Display Page ID.' \
  742.  -cm 0 6 \
  743.  -ce \
  744.  '         4   Display HELP information.' \
  745.  -cm 0 7 \
  746.  -ce \
  747.  '         5   Exit.' \
  748.  -cm 0 8 \
  749.  -ce \
  750.  -cm 0 9 \
  751.  -ce \
  752.  '             Enter Option: ' \
  753.  -cm 0 10 \
  754.  -ce \
  755.  -cm 0 22 \
  756.  '****************************  Default is Option 1  *****************************' \
  757.  -cm 27 9
  758. status=loop
  759. while test $status = "loop"
  760. do
  761.  read response
  762.  case "$response" in
  763.     4)  kurses -cm 0 11
  764.     cat  <<+ENDCAT
  765. ******************************  HELP INFORMATION  ******************************
  766. Option 1 - Help information for Option 1
  767.            
  768.            
  769.            
  770. Option 2 - Help information for Option 2
  771.            
  772.            
  773. Option 3 - Help information for Option 3
  774.            
  775. Option 5 - Exit this program.
  776. +ENDCAT
  777.     kurses \
  778.         -cm 13 9 -ce \
  779.         'Enter Option: '
  780.         status=loop
  781.         ;;
  782.     5)  kurses -cl
  783.         status=exit
  784.         exit
  785.         ;;
  786.     *)  
  787.     kurses \
  788.     -cm 0 11 \
  789.     '*****************************************' \
  790.     '***************************************' \
  791.     -cm 0 12 -ce \
  792.     -cm 0 13 -ce \
  793.     -cm 0 14 -ce \
  794.     -cm 0 15 -ce \
  795.     -cm 0 16 -ce \
  796.     -cm 0 17 -ce \
  797.     -cm 0 18 -ce \
  798.     -cm 0 19 -ce \
  799.     -cm 0 20 -ce \
  800.     -cm 0 21 -ce \
  801.     -cm 0 22  \
  802.     '*************************************************************' \
  803.         -cm 13 9 -ce \
  804.         'Enter Option: '
  805.     status="loop"
  806.  esac
  807. done
  808.  
  809.  
  810. RiesES_PIECES
  811. chmod +x 'shtest'
  812. fi
  813. exit 0
  814. #    End of shell archive
  815.  
  816.